package com.xinqi.modules.sys.dict.manager;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.sys.dict.domain.DictGradeSubjectEntity;
import com.xinqi.modules.sys.dict.dto.req.DictGradeSubjectQueryDTO;
import com.xinqi.modules.sys.dict.dto.rsp.DictGradeSubjectResultDTO;
import com.xinqi.modules.sys.dict.dto.rsp.DictSubjectResultDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 字典-年级学科管理层
 *
 * @author: linkai
 * @date: 2023/05/03
 */
public interface DictGradeSubjectManager extends BaseService<DictGradeSubjectEntity> {

    /**
     * 自定义分页查询
     */
    Page<DictGradeSubjectResultDTO> findPage(Page<Object> page, DictGradeSubjectQueryDTO query);

    /**
     * 自定义列表查询
     */
    List<DictGradeSubjectResultDTO> findList(DictGradeSubjectQueryDTO query);

    /**
     * 根据id查询 字典-年级学科数据
     */
    DictGradeSubjectEntity findById(Long id);

    /**
     * 根据id删除 字典-年级学科数据
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteById(Long id);

    List<DictSubjectResultDTO> findSubjectByGradeId(Long gradeId);

    List<DictSubjectResultDTO> findSubjectByStageId(Long stageId);

    List<DictSubjectResultDTO> findSubjectByVersionId(Long versionId);

    @Transactional(rollbackFor = Exception.class)
    Boolean addSubject(Long gradeId, List<Long> subjectIdList);

    @Transactional(rollbackFor = Exception.class)
    Boolean delSubject(Long gradeId);
}
